package com.sitech.portal.system.dao.ibatis;

import java.util.List;

import com.sitech.ibnms.core.BaseIbnmsDao;
import com.sitech.portal.system.dao.IFirstPageDao;

public class FirstPageDaoImpl extends BaseIbnmsDao implements IFirstPageDao {

	public List getLeftModule(String cModule_id) {
		return this.query("getLeftModule", cModule_id);
	}

	// 查询模块ID为两级的数据集合
	public List getLeftModule_child(String cModule_id) {
		return this.query("getLeftModule_child", cModule_id);
	}

	public List getEventAssetAll() {
		return this.query("getEventAssetAll", "");
	}

	public List getFirstPageTree(java.util.HashMap a) {
		return this.query("getFirstPageTree", a);
	}

	public List getFirstPageAll() {
		return this.query("getFirstPageAll", "");
	}

	public List getFirstPageByLoginId(String a) {
		return this.query("getFirstPageByLoginId", a);
	}

	public void delFirstPageByLoginId(String a) {
		this.delete("delFirstPageByLoginId", a);
	}

	public void insertFirstPageByLoginId(java.util.HashMap a) {
		this.insert("insertFirstPageByLoginId", a);
	}

	public List getCTypeModuleById(String a) {
		return this.query("getCTypeModuleById", a);
	}


	public List getTreeListByTypeModule(String cModuleID, String login_id) {
		String mySql = "";
		mySql += "SELECT   module_id, module_name, module_path, module_target FROM tb_sys_module"
				+ " WHERE SUBSTR (module_id, 1, 1)='"
				+ cModuleID
				+ "' AND module_enable = 1 AND module_id NOT IN ('9900000000')"
				+ " AND module_id IN (SELECT module_id FROM tb_sys_role_module"
				+ " WHERE role_id IN (SELECT role_id FROM tb_sys_user_role WHERE login_id = '"
				+ login_id + "')) ORDER BY module_id";
		return this.query("getTreeListByTypeModule", mySql);
	}

	public List getLeftModuleByRole(String cModule_id, String login_id) {
		String sql = "select MODULE_ID,MODULE_NAME,MODULE_PATH from tb_sys_module where module_id like '"
				+ cModule_id
				+ "%' and module_id in( "
				+ "select distinct module_id from tb_sys_role_module "
				+ "where role_id in(select role_id from tb_sys_user_role where login_id='"
				+ login_id + "') " + ") order by module_id";

		return this.query("getLeftModuleByRole", sql);

	}

	public List getListMonitorSwitch(String DEVICE_TYPE, String MANUFACTURER) {
		String mySql = "";
		mySql = "SELECT a.UNIT_ID, c.SWITCH_CH_NAME, b.SWITCH_SUBCLASS_NAME,"
				+ " a.DEVICE_ID, a.DEVICE_NAME, a.IP_CONF, a.USAGE"
				+ " from TB_ASSET_SWITCH a, TB_ASSET_SWITCH_SUBCLASS b, TB_ASSET_SWITCH_CLASS c"
				+ " where a.SWITCH_SUBCLS_ID = b.SWITCH_SUBCLASS_ID"
				+ " and a.MANUFACTURER = b.SWITCH_CLASS_ID"
				+ " and a.MANUFACTURER = c.SWITCH_CLASS_ID";
		if (MANUFACTURER != null && !MANUFACTURER.equals(""))
			mySql += " and a.MANUFACTURER = '" + MANUFACTURER + "'";
		if (DEVICE_TYPE != null && !DEVICE_TYPE.equals(""))
			mySql += " and a.SWITCH_SUBCLS_ID = '" + DEVICE_TYPE + "'";
		mySql += " ORDER BY a.MANUFACTURER";
		return this.query("getListMonitorSwitch", mySql);
	}

	public List getShSubClsByMnf(String MANUFACTURER) {
		String mySql = "";
		mySql = "SELECT a.SWITCH_SUBCLASS_ID, a.SWITCH_SUBCLASS_NAME"
				+ " FROM TB_ASSET_SWITCH_SUBCLASS a"
				+ " WHERE a.SWITCH_CLASS_ID = '" + MANUFACTURER
				+ "' AND a.STATUS = '1' ORDER BY a.SWITCH_SUBCLASS_ID";
		return this.query("getShSubClsByMnf", mySql);
	}

	public List getSwitchClass() {
		return (List) this.query("findSwitchClass", null);
	}

	public List getListMonitorRouter() {
		return this.query("getListMonitorRouter", "");
	}
}
